//package com.fenghen.jdbctempleplus.builder;
//
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.jdbc.core.RowMapper;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//
//public class QueryBuilder<T> {
//    private final Class<T> entityClass;
//    private final JdbcTemplate jdbcTemplate;
//    private final EntityParser entityParser;
//    private final List<Condition> conditions = new ArrayList<>();
//
//    public QueryBuilder(Class<T> entityClass, JdbcTemplate jdbcTemplate, EntityParser entityParser) {
//        this.entityClass = entityClass;
//        this.jdbcTemplate = jdbcTemplate;
//        this.entityParser = entityParser;
//    }
//
//    public QueryBuilder<T> where(String condition, Object... params) {
//        conditions.add(new Condition(condition, params));
//        return this;
//    }
//
//    public List<T> execute() {
//        EntityMeta meta = entityParser.parse(entityClass);
//        String sql = SqlBuilder.buildSelectSql(meta, conditions);
//        RowMapper<T> rowMapper = new BeanPropertyRowMapper<>(entityClass);
//        return jdbcTemplate.query(sql, rowMapper, conditions.stream()
//                .flatMap(c -> Arrays.stream(c.getParams()))
//                .toArray());
//    }
//}